package com.jswlw.controller.distributor;

import com.jswlw.controller.api.helper.UserHelper;
import com.jswlw.entity.biz.DistributionAccounts;
import com.jswlw.entity.biz.DistributionRecord;
import com.jswlw.service.biz.DistributionAccountsService;
import com.jswlw.service.biz.DistributionRecordService;
import com.jswlw.web.manager.SessionDistributorManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 吴维斌 E-mail:wuweibin0817@163.com
 * @version 创建时间：${date} ${time}
 */
@Controller
@RequestMapping("/distributor/info")
public class DistributorDistributorInfoController {

    @Autowired
    DistributionRecordService recordService;
    @Autowired
    DistributionAccountsService accountsService;
    @Autowired
    UserHelper userHelper;

    @RequestMapping("record")
    public ModelAndView record() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/distributor/info/record");
        DistributionRecord filter = new DistributionRecord();
        filter.setDistributorId(SessionDistributorManager.getCurrentUser().getDistributorId());
        modelAndView.addObject("recordList", recordService.queryList(filter));
        return modelAndView;
    }

    @RequestMapping("accounts")
    public ModelAndView accounts() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/distributor/info/accounts");
        DistributionAccounts filter = new DistributionAccounts();
        filter.setDistributorId(SessionDistributorManager.getCurrentUser().getDistributorId());
        modelAndView.addObject("accountList", accountsService.queryList(filter));
        return modelAndView;
    }
}
